function Share(params) {}
//live encoder模块推流方法
Share.prototype.liveModule = function (data, ProducerLite) {
	var url = data.url;
	if (typeof(url) != "string") return;
	oUtils.ajaxReq(url,data.param,function(result){
		if (result.errorCode == '0x0') {
			if (ProducerLite) {
				return;
			}
			$("#" + data.param.rId).find(".block").parents(".shareIcon").removeClass("bgGreen");
            $("#" + data.param.rId).find(".block").removeClass("block selectAllBg");
			$("#" + data.param.rId).children(".loading").fadeOut(1000);
			shareIsprocessing = false;
		} else {
			this.Outils(result, data, ProducerLite);
		}
	}.bind(this), true, 'json', function (error) {
		$("#" + data.param.rId).children(".loading").fadeOut(1000);
		oUtils.alertTips('i18n_wait');
	}, 'post', 30000);
}


//根据返回值弹出相应的提示
Share.prototype.Outils = function (result, data, ProducerLite) {
	if (result.errorCode === "0x80523304") {
		oUtils.alertTips('i18n_invalidCopierName');
	} else if (result.errorCode === "0x80100001") {
		oUtils.alertTips('i18n_parameterError');
	} else if (result.errorCode === "0x80100019") {  //0x80100019推流部分失败
		var errInfoList = JSON.parse(result.errorInfo);
		// 处理推流失败部分
		var faildAccounts = errInfoList.failed;
		if (faildAccounts != '') {
			var errorCode = [];
			var commonAccounts = [], inkeAccounts = [], youtubeAccounts = [], pandaAccounts = [],
                yiLiveAccounts = [];
			$.each(faildAccounts,function(idx,itm){
				errorCode.push(itm.errorCode);
				if (itm.type === "I") {
					inkeAccounts.push(itm.nickName);
				} else if (itm.type === "P") {
					if (itm.rtmpUrl) {
						if (itm.rtmpUrl.errorInfo.indexOf("room not exists") != -1) {
							pandaAccounts.push(itm.nickName);
						} else {
							commonAccounts.push(itm.nickName);
						}
					}
				} else if (itm.type === "Z") {
					if (itm.rtmpUrl) {
						if (itm.rtmpUrl.result > 500) {
							inkeAccounts.push(itm.nickName);
						} else {
							commonAccounts.push(itm.nickName);
						}
					}
				} else if (itm.type === "Y") {
					if (itm.rtmpUrl) {
						commonAccounts.push(itm.nickName);
					} else {
						youtubeAccounts.push(itm.nickName);
					}
				} else {
					commonAccounts.push(itm.nickName);
				}
			});
			var cPlatformTips = "", ePlatformTips = "";
			if (commonAccounts != "") {
				if (errorCode.length > 0) {
					var accountThis = commonAccounts[0];
					var erroritem = errorCode[0];
					var errorTip = '';
					if (erroritem == '001') {
						ePlatformTips += '<div>Network timeout [' + erroritem + ']</div>';
						cPlatformTips += '<div>网络超时 [' + erroritem + ']</div>';
					} else if (erroritem == '403') {
						ePlatformTips += '<div>Server denied access [' + erroritem + ']</div>';
						cPlatformTips += '<div>服务器拒绝访问 [' + erroritem + ']</div>';
					} else if (erroritem == '400'){
						ePlatformTips += '<div>'+ accountThis +' Parameter error [' + erroritem + ']</div>';
						cPlatformTips += '<div>'+ accountThis +' 参数错误 [' + erroritem + ']</div>';
					} else if (erroritem == '1021') {
						ePlatformTips += '<div>User authentication expired [' + erroritem + ']</div>';
						cPlatformTips += '<div>用户认证过期 [' + erroritem + ']</div>';
					} else if (erroritem == '7000') {
						ePlatformTips += '<div>User authentication information not correct [' + erroritem + ']</div>';
						cPlatformTips += '<div>用户认证信息不正确 [' + erroritem + ']</div>';
					} else if (erroritem == '100') {
						ePlatformTips += '<div>The room does not exist [' + erroritem + ']</div>';
						cPlatformTips += '<div>房间不存在 [' + erroritem + ']</div>';
					} else if (erroritem == '505') {
						ePlatformTips += '<div>authentication account expired [' + erroritem + ']</div>';
						cPlatformTips += '<div>认证账户过期 [' + erroritem + ']</div>';
					}
				}
			}
			if (youtubeAccounts != "") {
				var youtubeName = youtubeAccounts.join(", ");
				ePlatformTips += '<div>Account ' + youtubeName + ' user is living now.</div>';
				cPlatformTips += '<div>账号 ' + youtubeName + ' 用户正在直播。</div>';
			}
			if (pandaAccounts != "") {
				var pandaName = pandaAccounts.join(", ");
				ePlatformTips += '<div>Account ' + pandaName + ' does not have permission to go live on PandaTV.</div>';
				cPlatformTips += '<div>账号 ' + pandaName + ' 在熊猫TV未开通直播权限。</div>';
			}
			if (inkeAccounts != "") {
				var inkeName = inkeAccounts.join(", ");
				ePlatformTips += '<div>Account ' + inkeName + ' failed to go live.</div>';
				cPlatformTips += '<div>账号 ' + inkeName + ' 开启直播失败。</div>';
			}
			fn_switchLangAlertTip(ePlatformTips, cPlatformTips);
		}

		// 处理推流成功部分
		var sucAccounts = errInfoList.success;
		if (sucAccounts != '') {
			$.each(sucAccounts, function (idx, item) {
				if (item.type == "S") {
					var shareNickNames = $("#" + data.param.rId).find(".shareIcon").find(".shareNickName");
					for (var j = 0; j < shareNickNames.length; j++) {
						if (shareNickNames.eq(j).html() == item.nickName) shareNickNames.eq(j).parents(".shareIcon").children(".icon-socialMeida").attr("data-liveId", item.liveVideoId);
					}
				}
				//一直播绑定scid
				if (item.scid) {
					var shareNickNames = $("#" + rId).find(".shareIcon").find(".shareNickName");
					for (var j = 0; j < shareNickNames.length; j++) {
						if (shareNickNames.eq(j).html() == item.nickName) shareNickNames.eq(j).parents(".shareIcon").children(".icon-socialMeida").attr("data-scid", item.scid);
					}
				}
			});
		}
	} else if (result.errorCode == "0x80100016") {
        oUtils.alertTips('i18n_cannotUseCloudR');
    } else if (result.errorCode == "0x80100008") {
        oUtils.alertTips(result.errorInfo + ',please re-certify');
    } else if (result.errorCode == "0x80100003") {
        oUtils.alertTips('i18n_livingSteamError');
    } else if (result.errorCode == '1021') {
        oUtils.alertTips('i18n_userAuthenticationExpired');
    } else if (result.errorCode == '7000') {
        oUtils.alertTips('i18n_userInfoErr');
    } else if (result.errorCode == '001') {
		oUtils.alertTips('i18n_networkTimeout');
	} else if (result.errorCode == '403') {
		oUtils.alertTips('i18n_serverDeniedAccess');
	} else if (result.errorCode == '400') {
		oUtils.alertTips('i18n_parameterError');
	} else if (result.errorCode == '100') {
		oUtils.alertTips('i18n_theRoomDoesNotExist');
	} else if (result.errorCode == '505') {
		oUtils.alertTips('i18n_authenticationAccountExpired');
	} else if (result.errorCode == '0x80523400') {
		oUtils.alertTips('i18n_pushFailed');
	} else if(result.errorCode == '0x80100008'){
		oUtils.alertTips('i18n_pushFailed');
	} else if(result.errorCode == '0x80523404'){
		oUtils.alertTips('i18n_pushFailed');
	} else if(result.errorCode == '0x80100020'){   //0x80100020推流全部失败
		if (ProducerLite && JSON.parse(result.errorInfo).failed[0].errorCode == '505') {
			oUtils.alertTips('i18n_reAuthenticate');
		} else {
			oUtils.alertTips('i18n_ShareFailure');
		}
	} else if (result.errorCode == '0x80520101') {
		oUtils.alertTips('i18n_moduleNotFound');
	} else if (result.errorCode == '0x80100002') {
		oUtils.alertTips("i18n_rNotConnectCC");
	} else {
		oUtils.alertTips(result.errorInfo);
	}
	$("#" + data.param.rId).children(".loading").fadeOut(1000);
    shareIsprocessing = false;
}
export {
    Share
};